package com.peanut.bosskg.service.other;


import com.alibaba.fastjson.JSON;
import com.peanut.bosskg.entity.ResponseMessageVO;
import com.peanut.bosskg.entity.entinfo.QueryAccountBalanceRequestDTO;
import com.peanut.bosskg.entity.entinfo.QueryAccountBalanceResponseDTO;
import com.peanut.bosskg.enums.FunCodeEnum;
import com.peanut.bosskg.service.BaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 商户查询账户可用余额
 *
 * @author peanut
 */
@Service
@Slf4j
public class AccountQueryService extends BaseService {
    /**
     * @param funCodeEnum
     * @param accountQuery
     * @return
     * @throws Exception
     */
    public QueryAccountBalanceResponseDTO doBusiness(FunCodeEnum funCodeEnum, QueryAccountBalanceRequestDTO accountQuery) throws Exception {
        log.info("商户账户余额查询开始:{}，{}", funCodeEnum, accountQuery);
        ResponseMessageVO responseMessage = applyYouFuByHttpPost(funCodeEnum, accountQuery);
        QueryAccountBalanceResponseDTO accountQueryResult = JSON.parseObject(responseMessage.getResData(), QueryAccountBalanceResponseDTO.class);
        log.info("商户账户余额查询结束:{}", accountQueryResult);
        return accountQueryResult;
    }
}
